<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddNewFieldForStoreAudit extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('stores', function (Blueprint $blueprint) {
            $blueprint->string('audit_message')->default('')->comment('审核消息，若该值存在的时候，审核状态为 0 表示被拒绝的审核');
            $blueprint->boolean('real_name_authentication')->default(false)->comment('实名认证');
            $blueprint->boolean('provider_authentication')->default(false)->comment('供应商认证');
            $blueprint->integer('level')->default(1)->comment('店铺等级')->index();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('stores', function (Blueprint $blueprint) {
            $blueprint->dropColumn('audit_message');
            $blueprint->dropColumn('real_name_authentication');
            $blueprint->dropColumn('provider_authentication');
            $blueprint->dropColumn('level');
            $blueprint->dropIndex('stores_level_index');
        });
    }
}
